/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-06-25     WangJing       the first version
 */
#include "key.h"

void key_KA(int power){
    HAL_GPIO_WritePin(ARM1_KA_GPIO_Port, ARM1_KA_Pin,(GPIO_PinState)power);
}

int8_t key_scan(uint8_t key_num){
	switch(key_num){
		case 0 : return (int8_t)HAL_GPIO_ReadPin(ARM1_KEY1_GPIO_Port,ARM1_KEY1_Pin);
		case 1 : return (int8_t)HAL_GPIO_ReadPin(ARM1_KEY2_GPIO_Port,ARM1_KEY2_Pin);
		case 2 : return (int8_t)HAL_GPIO_ReadPin(ARM1_KEY3_GPIO_Port,ARM1_KEY3_Pin);
		case 3 : return (int8_t)HAL_GPIO_ReadPin(ARM1_SB_GPIO_Port,ARM1_SB_Pin);
		default : return -1;
	}
}

